class PageController < ApplicationController
  caches_page :home, :about, :rates, :policies, :points
  def home; @current_page = "home"; end

  def fleet; @current_page = "fleet"; end

  def rates; @current_page = "rates"; end

  def about; @current_page = "about"; end
  
  def policies; @current_page = "policies"; end
  
  def points; @current_page = "points"; end

  def reserve
    @reservation = Reservation.new
    @current_page = "reservation"
  end
  
  def reserve_now
    #raise inspect
    @current_page = "reservation"
    @reservation = Reservation.new(params[:reservation])
    if @reservation.save
      ReservationMailer.deliver_reservation_mail(@reservation)
      flash[:notice] = "Reservation has been successful. An agent will contact you shortly."
      respond_to do |format|
        format.html { redirect_to :action => "reserve" }
        format.js
      end
    else
      render :action => "reserve"
    end
  end
  
  def feedback
      @feedback = Feedback.new
      @current_page = "contact"
  end
  
  def send_feedback
    @current_page = "contact"
      @feedback = Feedback.new(params[:feedback])
      if @feedback.save
          FeedbackMailer.deliver_feedback_mail(@feedback)
          flash[:notice] = "Thank you for your feedback."
          respond_to do |format|
              format.html { redirect_to :action => "feedback" }
              format.js
          end
      else
          render :action => "feedback"
      end 
  end
end